<html>

<head>
    <script type="text/javascript">
        function say() {
            alert("tow.html");
        }
        function callParent() {
            parent.say();
            parent.window.document.getElementById("button").value = "调用结束";

            //var iframe = getFrameInParent()
            parent.postMessage("close", "*");
        }

        //获取当前iframe
        function getFrameInParent(){
            console.log("parent:", parent)
            console.log("parent.window:", parent.window)
            var iframes =  parent.window.document.getElementsByTagName("iframe");
            var len =  iframes.length;
            for(var i = 0; i < len; i++){
                if(iframes[i].contentWindow.document === document){
                    return iframes[i];
                }
            }
        }
    </script>
</head>

<body>
    <input id="button" type="button" value="one.html中的say()函数" onclick="callParent()" />
</body>
<script>
    

    
</script>

</html>